#include "game.h"
void menu ()
{
    printf("----------------------\n");
    printf("------  1.play  ------\n");
    printf("------  0.exit  ------\n");
    printf("----------------------\n");
}

void game ()
{
    //初始化棋盘
    char mine[ROWS][COLS];
    char show[ROWS][COLS];
    init_board (mine,ROWS,COLS,'0');
    init_board (show,ROWS,COLS,'*');

    //打印棋盘
    display_board (show,ROW,COL);
    display_board (mine,ROW,COL);

    //布雷
    set_mine (mine,ROW,COL);
    //display_board (mine,ROW,COL);

    //扫雷
    find_mine(mine,show,ROW,COL);
}

int main ()
{
    srand ((unsigned int)time(NULL));
    int input=0;
    do
    {
        printf ("请选择：\n");
        menu ();
        scanf("%d",&input);
        switch(input)
        {
            case 1:
                game ();
                break;
            case 0:
                printf ("退出游戏\n");
                break ;
            default:
                printf("选择错误，重新选择\n");
                break;
        }
    } while (input);
    
    return 0;
}